package com.sbtr.controller.feature;

import com.sbtr.common.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.sbtr.exception.BDException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.sbtr.common.PageDto;
import com.sbtr.business.feature.entity.FePcaRule;
import com.sbtr.business.feature.dto.FePcaRuleDto;
import com.sbtr.business.feature.service.FePcaRuleService;
import org.springframework.web.bind.annotation.RestController;
import com.sbtr.controller.common.CommonController;

/**
 * 主成分分析规则字段列表 前端控制器
 *
 * @author dgl
 * @since 2023-05-08
 */
@RestController
@RequestMapping("/fePcaRule")
@Api(tags = "主成分分析规则字段列表")
public class FePcaRuleController extends CommonController<FePcaRule,FePcaRuleService> {

    @GetMapping("/pageList")
    @ApiOperation(httpMethod = "GET", value = "分页列表")
    public Response<PageDto<FePcaRule>> pageList(FePcaRuleDto fePcaRuleDto){
        return Response.success(u.pageList(fePcaRuleDto));
    }

    @PostMapping("/save")
    @ApiOperation(httpMethod = "POST", value = "保存")
    public Response<FePcaRule> save(@RequestBody FePcaRule fePcaRule){
        fePcaRule.setId(null);
        if(fePcaRule.insert()){
            return Response.success(fePcaRule);
        }else throw new BDException("保存失败");
    }

}

